#include "Singleton.h"
#include "user_service.pb.h"
#include <unordered_map>

class UserContainer : public Singleton<UserContainer>
{
    friend class Singleton<UserContainer>;
public:
/*
    //创建用户
    rpc CreateUser(CreateUserRequest) returns(CreateUserResponse);
    //获取用户
    rpc GetUser(GetUserRequest) returns(UserInfo);
    //更新用户
    rpc UpdateUser(UserInfo) returns(UpdateUserResponse);
    //删除用户
    rpc DeleteUser(DeleteUserRequest) returns(DeleteUserResponse);
*/
    bool AddUser(int user_id, const std::string &name,int age);
    bool GetUser(int user_id,user_service::UserInfo *user_info);
    bool UpdateUser(int user_id, std::string name,int age);
    bool DeleteUser(int user_id);
    ~UserContainer()=default;



private:
    UserContainer()=default;
    std::unordered_map<int,user_service::UserInfo> user_map_;
};